import unittest
from config.config import USERNAME, PASSWORD
from time import sleep
from tools.driver import chrome
from pages.stock_in_page import StockInPage
from pages.stock_out_page import StockOutPage
from pages.pay_page import PayPage
from pages.login_page import LoginPage
from tools.function import get_self_pickup_file
from pages.pay_record_page import PayRecordPage


class BaseCase(unittest.TestCase):
    def setUp(self) -> None:
        get_self_pickup_file(3, 0)
        self.driver = chrome()
        login_page = LoginPage(self.driver)
        login_page.goat_erp_login(USERNAME, PASSWORD)
        self.stock_in_page = StockInPage(self.driver)
        self.stock_out_page = StockOutPage(self.driver)
        self.pay_page = PayPage(self.driver)
        self.pay_record_page = PayRecordPage(self.driver)

    def tearDown(self) -> None:
        sleep(1)
        self.driver.quit()